#include "Tile.h"
#include "Thing.h"
#include "Item.h"
#include "Creature.h"

Tile::Tile()
{
	//
}

Tile::~Tile()
{
	//
}

bool Tile::addThing(Thing* thing)
{
	thing->setTile(this);
	
	Item* item = dynamic_cast<Item*>(thing);
	
	if(item)
	{
		m_items.push_back(item);
		return true;
	}
	
	Creature* creature = dynamic_cast<Creature*>(thing);
	if(creature)
	{
		m_creatures.push_back(creature);
		return true;
	}
	
	thing->setTile(0);
	return false;
}

const ItemList Tile::getItems() const
{
	return m_items;
}

const CreatureList Tile::getCreatures() const
{
	return m_creatures;
}

const Position Tile::getPosition() const
{
	return m_position;
}

Position Tile::getPosition()
{
	return m_position;
}

void Tile::setPosition(uint16_t x, uint16_t y, uint8_t z)
{
	m_position.x = x;
	m_position.y = y;
	m_position.z = z;
}
